﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 自动分帧
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            string rules = tbRules.Text;
            string[] rulesStr = null;
            if (rules.Contains(",") == true)
                rulesStr = tbRules.Text.Split(',');
            else
                rulesStr = new string[]{ rules };

            tbNewFrame.Text = "";

            string oldFrame = tbOldFrame.Text;
            string[] newStrArr = oldFrame.Split(rulesStr, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 1; i < newStrArr.Length; i++)
            {
                newStrArr[i] = rules + newStrArr[i];
            }
                
            foreach (string str in newStrArr)
            {
                tbNewFrame.Text = tbNewFrame.Text + str + "\r\n";
            }
        }
    }
}
